﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using System.Web;

namespace TADF.Com.Alpha.Core.View
{
    public class WebContext
    {
        //private HttpContext context;
        //private static IList sessions = new ArrayList();

        //public static String getPageContent(HttpRequest request, HttpResponse response, string page){
        //RequestDispatcher rd = Application.getWebContext().getServletContext().getRequestDispatcher(page);
        //final ByteArrayOutputStream os = new ByteArrayOutputStream();
        //final ServletOutputStream stream = new ServletOutputStream() {
        //    public void write(byte[] data, int offset,
        //            int length) {
        //        os.write(data, offset, length);
        //    }

        //    public void write(int b) throws IOException {
        //        os.write(b);
        //    }
        //};
        //final PrintWriter pwt = new PrintWriter(new OutputStreamWriter(os));
        //HttpServletResponse rep = new HttpServletResponseWrapper(response)
        //{
        //    public ServletOutputStream getOutputStream()
        //    {
        //        return stream;
        //    }
           
        //    public PrintWriter getWriter()
        //    {
        //        return pwt;
        //    }
        //};
        //try {
        //    rd.include(request, rep);
        //} catch (ServletException e) {
        //    e.printStackTrace();
        //} catch (IOException e) {
        //    e.printStackTrace();
        //}
        //pwt.flush();
        
        //try {
        //    return new String(os.toByteArray(), "UTF-8");
        //} catch (UnsupportedEncodingException e) {
        //    return new String(os.toByteArray());
        //}
    }
}
